package adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.qianfeng.lingshijia.DetailsActivity;

import fragment.DetailsFragment;
import fragment.More_details_fragment;
import fragment.TypeFragment;

/**
 * Created by Administrator on 2016/1/13.
 */
public class ViewPageAdapter extends FragmentPagerAdapter {
    private int productId;

    public ViewPageAdapter(FragmentManager fm,int productId) {
        super(fm);
        this.productId = productId;

    }

    @Override
    public Fragment getItem(int arg0) {
        // TODO Auto-generated method stub
        switch (arg0) {
            case 0:
                DetailsFragment detailsFragment = new DetailsFragment();
                detailsFragment.setProductId(productId);
                return detailsFragment;
            case 1:
                More_details_fragment more_details_fragment = new More_details_fragment();
                more_details_fragment.setProductId(productId);
                return more_details_fragment;
            case 2:
                TypeFragment typeFragment = new TypeFragment();
                typeFragment.setProductId(productId);
                return typeFragment;

        }
        return null;
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return 3;
    }
}
